package com.ap.core.business.message.domain.translators.header.impl;

import com.ap.core.business.message.domain.translators.AbstractHeaderTranslator;
import com.ap.core.business.message.domain.translators.BindingListener;
import com.ap.core.business.message.domain.translators.BindingMetaData;
import com.ap.core.business.message.domain.translators.Translator;
import com.ap.core.common.types.InputMessageType;
import com.ap.core.domain.ApMessage;
import com.ap.core.exception.BusinessFailureException;
import com.ap.core.message.managertp.info.SubmitRTPMessageInfo;

/**
 * User: Ranjit.Singh
 * Implementation class for {@link Translator}
 */
public class SubmitRTPMsgHdrTranslator extends AbstractHeaderTranslator<SubmitRTPMessageInfo> {


    @Override
    public void translate(SubmitRTPMessageInfo boundObject, BindingMetaData metaData, BindingListener bindingListener) throws BusinessFailureException {
        final InputMessageType inputMessageType = metaData.getInputMessageType();
        final ApMessage apMessage = populateApEvent(inputMessageType, metaData.getReconciliationInfo().getReconciliationCycleId(), metaData.getReconciliationInfo().getReconciliationDate(), boundObject.getMsgHdr().getMsgId(), boundObject.getMsgHdr().getMsgTimestamp(), boundObject.getRTPSenderInfo().getDistributorInfo().getDistributorId()) ;
        bindingListener.onApMessage(apMessage, null);
    }
}
